﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Blizzard.Contracts;
using Blizzard.Interceptors;

namespace Blizzard.Test.DataObjects
{
    [Mapper(Table = "b")]
    public class B : IDataObject
    {
        Interceptor _interceptor;
        

        [Mapper(Field = "ID", IsIdentityColumn = true)]
        public int Id { get; set; }

        private string _name;
        [Mapper(Field = "Name")]
        public string Name
        {
            get
            {
                _interceptor.Intercept(this, "Name", false);
                return _name;
            }
            set
            {
                _interceptor.Intercept(this, "Name", true, _name, value);
                _name = value;
            }
        }


        private BList<C> cees;

        public BList<C> Cees
        {
            get 
            {
                _interceptor.Intercept(this, "Cees", false);
                return cees; 
            }
            set 
            {
                _interceptor.Intercept(this, "Cees", true, cees, value);
                cees = value; 
            }
        }



        private BList<CC> cCees;

        public BList<CC> CCees
        {
            get 
            {
                _interceptor.Intercept(this, "CCees", false);
                return cCees; 
            }
            set 
            {
                _interceptor.Intercept(this, "CCees", true, cCees, value);
                cCees = value; 
            }
        }


       


        public A _aaa;
        
        [Mapper(Field = "[a ID]", Composition = true)]
        public A aaa
        {
            get 
            {
                _interceptor.Intercept(this, "aaa", false);
                return _aaa; 
            }
            set 
            {
                _interceptor.Intercept(this, "aaa", true, _aaa, value);
                _aaa = value; 
            }
        }

       


        private BList<BB> bBees;
        
        [Mapper(JoinTable = "b2b", MyIdField = "BId")]
        public BList<BB> BBees
        {
            get 
            {
                _interceptor.Intercept(this, "BBees", false);
                return bBees; 
            }
            set 
            {
                _interceptor.Intercept(this, "BBees", true, bBees, value);
                bBees = value; 
            }
        }

   

        public Container.BlizzardManager Manager
        {
            set { _interceptor = new Interceptor(value); }
        }
    }
}
